<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
<jsp:include page="../common/common.jsp" />
</head>
<body class="page-header-fixed">
	<jsp:include page="../common/header.jsp" />

	<div class="clearfix"></div>
	<div class="page-container">
		<div class="page-sidebar-wrapper"><jsp:include
				page="../common/menu.jsp" /></div>
		<div class="page-content-wrapper">
			<div class="page-content">
				<div class="row">
					<div class="col-md-12">
						<form class="form-horizontal form-row-seperated" id="form"
							method="post" action="${path}/pptList/save">
							<div class="portlet box purple">
								<div class="portlet-title">
									<div class="caption">
										<i class="fa fa-shopping-cart"></i>基础数据详细内容
									</div>
									<div class="actions btn-set">
										<a href="javascript:history.go(-1);" class="btn default"><i
											class="fa fa-angle-left"></i> 返回</a>
										<button type="button" onclick="save()" class="btn blue">
											<i class="fa fa-check"></i> 保存
										</button>
									</div>
								</div>
								<div class="portlet-body">
									<div class="tabbable">
										<div class="tab-content no-space">
											<div class="tab-pane active" id="tab_general">
												<div class="form-body">

													<div class="form-group">
														<label class="col-md-2 control-label">演讲人: <span
															class="required"> </span>
														</label>

														<div class="col-md-5">
															<input type="text" id="pptcontacts" name="pptcontacts"
																class="form-control measure-input"
																value="${data.pptcontacts}" />
														</div>
														<div class="col-md-5">
															<!--                                                         &nbsp;可输入<b><span id="title_len">32</span></b> 个字符 -->
														</div>
													</div>
  											<div class="form-group">
                                                <label class="col-md-2 control-label">封面：</label>
												<input type="hidden" id="imgUrl" name="imgUrl" class="form-control" value="${data.imgUrl}"/>                                         

                                                <div class="col-md-8">
                                                    <div class="fileinput fileinput-new" data-provides="fileinput">
                                                        <div class="fileinput-new thumbnail" style="width: 300px; height: 150px;">
                                                            <img src="${data.imgUrl}">
                                                        </div>
                                                        <div class="fileinput-preview fileinput-exists thumbnail"
                                                             style="max-width: 300px; max-height: 150px;">
                                                        </div>
                                                        <div>
                                                            <span class="btn default btn-file">
                                                                <span class="fileinput-new">选择图片</span>
                                                                <span class="fileinput-exists">修改图片</span>
                                                                <input type="file" id="file" name="file"/>
                                                            </span>
                                                            <a href="#" class="btn default fileinput-exists"
                                                               data-dismiss="fileinput">移除图片
                                                            </a>
                                                        </div>
                                                    </div>
                                                    <h4 style="color:red"></h4>
                                                </div>
                                            </div>
													<div class="form-group">
														<label class="col-md-2 control-label">描述: <span
															class="required"> </span>
														</label>

														<div class="col-md-5">
															<input type="text" id="pptdescribe" name="pptdescribe"
																class="form-control measure-input"
																value="${data.pptdescribe}" />
														</div>
														<div class="col-md-5">
															<!--                                                         &nbsp;可输入<b><span id="title_len">32</span></b> 个字符 -->
														</div>
													</div>
													
												     
												</div>
											</div>
										</div>
									</div>
								</div>

								<div class="portlet-title">
									<div class="actions btn-set">
										<a href="javascript:history.go(-1);" class="btn default"><i
											class="fa fa-angle-left"></i> 返回</a>
										<button type="button" onclick="save()" class="btn blue">
											<i class="fa fa-check"></i> 保存
										</button>
									</div>
								</div>
							</div>
							<input type="hidden" id="id" name="id" value="${data.id}">
									<input type="hidden" id="liveId" name="liveId" value="${liveId}">
							 
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="../common/footer.jsp" />
	<script type="text/javascript" src="${path}/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
	<script type="text/javascript" src="${path}/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
<script type="text/javascript" src="${path}/assets/scripts/biz/ajaxfileupload.js"></script>
	<script>
	function save(){
		if(isok){
			var image=$("#imgUrl").val();
			if ($("#file").val() != null && $("#file").val() != "") {
				$.ajaxFileUpload({
					url : '${path}/conf/upload',
					async : false,
					secureuri : false,
					fileElementId : 'file',
					dataType : 'json',
					success : function(data, status) {
						if (data.statusCode == 200) {
							$("#imgUrl").val(data.uri);
							$("#form").submit();
							return;
						}else{
							layer.alert("糟糕！ 图片上传失败...", {
				  		        icon: 2,
				  		        offset: 'middle',
				  		        time: 3000, 
				  		        skin: 'layui-layer-lan'
				  		    });
						}
					}
				});
			}else{
				 if(image==null||image==""){
					    layer.alert("请选择一张图片进行上传", {
			  		        icon: 2,
			  		        offset: 'middle',
			  		        time: 3000, 
			  		        skin: 'layui-layer-lan'
			  		    });
					    return false;
					}else{
						$("#form").submit();		
					}
			}	
		}
	}
	//检测图片是否符合规范
	function checkTypes(id) {
		var File_box = document.getElementById(id);
		var extend = File_box.value.substring(File_box.value
				.lastIndexOf(".") + 1);
		if (extend == "jpg" || extend == "png" || extend == "jpeg"
				|| extend == "bmp" || extend == "gif") {
			return true;
		}
	}
		
	    function isok() {
	    	//非空验证
	    	if($("#pptcontacts").val()==""){
	    		alert("演讲人不能为空!");
	            return;
	    	}
	    	
	    	
	}
	</script>
</body>
</html>